<?php
/**
 * Users_Form_Users_Registration
 *
 * @version $Id$
 */
class Users_Form_Users_Create extends Zend_Form
{
    /**
     * Form initialization
     *
     * @return self
     */
    public function init()
    {
        $this->setMethod('post')
             ->setName('createForm');

        $this->addElement($this->_email());
        $this->addElement($this->_firstName());
        $this->addElement($this->_lastName());
        $this->addElement($this->_password());
        $this->addElement($this->_status());
        $this->addElement($this->_submit());

        return $this;
    }

    protected function _email()
    {
        $field = new Zend_Form_Element_Text('email');
        $field->setLabel('User email');
        $field->setRequired(true);
        return $field;
    }

    protected function _firstName()
    {
        $field = new Zend_Form_Element_Text('firstName');
        $field->setLabel('First Name');
        $field->addValidator(new Zend_Validate_Alnum())
              ->addValidator(new Zend_Validate_StringLength(3, 10));

        $field->setRequired(true);
        return $field;
    }

    protected function _lastName()
    {
        $field = new Zend_Form_Element_Text('lastName');
        $field->setLabel('Last Name');
        $field->addValidator(new Zend_Validate_Alnum())
              ->addValidator(new Zend_Validate_StringLength(3, 10));

        $field->setRequired(true);
        return $field;
    }

    protected function _status()
    {
        $field = new Zend_Form_Element_Radio('status');
        $field->setLabel('Status Name');
        $field->setRequired(true);

        $field->addMultiOption('1', 'Enabled');
        $field->addMultiOption('0', 'Disabled');
        return $field;
    }

    protected function _password()
    {
        $field = new Zend_Form_Element_Password('password');
        $field->setLabel('Password');
        $field->setRequired(true);
        $field->addValidator(new Zend_Validate_StringLength(6));

        return $field;
    }

    protected function _submit()
    {
        $field = new Zend_Form_Element_Submit('submit');
        $field->setValue('Login');

        return $field;
    }
}